[win] Don't build a custom nanosleep() when not needed#1256
Conversation
This reverts commit 64aa543.
Instead of relying of the includes order we should properly check if the function is actually provided by our version of pthread library.
|
There is still an unorthodox usage of Though I'm not sure if such a change is acceptable or not |
It seems like there is some issue with that with MSYS2: msys2/MINGW-packages#10459
It used to exist even if not in a standard. Google search on it first hit leads me to; Since it is unorthodox it is OK to change it IMO. |
|
I approve the change but wait to see what you do about |
|
Hi, @ddennedy! I did a small test here and it seems like it is not easy to add So, we have three options here:
|
|
|
| @@ -22,6 +22,10 @@ | |||
| #ifndef MLT_TYPES_H | |||
| #define MLT_TYPES_H | |||
|
|
|||
| #ifndef GCC_VERSION | |||
| #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) | |||
| #endif | |||
|
|
|||
There was a problem hiding this comment.
This PR has too many unnecessary changes:
- reverting a copyright year
- adding this GCC_VERSION macro that is not used
| int nanosleep( const struct timespec * rqtp, struct timespec * rmtp ) | ||
| { | ||
| if (rqtp->tv_nsec > 999999999) { | ||
| /* The time interval specified 1,000,000 or more microseconds. */ | ||
| errno = EINVAL; | ||
| return -1; | ||
| } | ||
| return usleep(rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000); | ||
| } | ||
| return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 ); | ||
| } |
There was a problem hiding this comment.
Do not change white space: spaces to tabs, and extra spaces added inside parantheses
| if(MINGW) | ||
| string(REPLACE "iconv" "pthread" MLT_PTHREAD_LIBS "${Iconv_LIBRARY}") |
There was a problem hiding this comment.
This was added for a reason not too long ago. See git blame. Explain why it is no longer needed.
Instead of relying of the includes order we should properly
check if the function is actually provided by our version
of pthread library.
The patch basically reverts an original hack to resolve the
issue in msys2 and implements a proper detection mechanism
for the presence of nanosleep() in the pthread library